package dev.ece.suit.text;

import java.util.List;

import org.lwjgl.opengl.GL11;

import dev.ece.core.cells.model.base.SquareUI;
import dev.ece.util.lib.Rectangle;
import dev.ece.util.lib.Vector2f;
import dev.ece.util.lib.Vector3f;
import dev.ece.util.tools.Camera;

public class TextCharacter extends SquareUI<Integer> {

	private char word;
	
	private int first;
	
	private int size;
	
	public TextCharacter(char word, float width, float height, Rectangle textureClipping) {
		super(width, height, textureClipping);
		this.word = word;
	}

	@Override
	protected void setup() {}
	
	protected void initialize(int index, List<Vector3f> vertice, List<Vector2f> uvs) {
		this.size = this.getVertice().length;
		this.first = index * this.size;
		for(int i=0; i<size; i++) {
			vertice.add(this.getVertice()[i]);
			uvs.add(this.getUv()[i]);
		}
		this.initialize();
	}

	@Override
	public void onInitialize() {}

	@Override
	public void onRender(Camera camera, Integer value) {
		GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, this.getFirst(), this.getSize());
	}

	public char getWord() {
		return word;
	}

	public int getFirst() {
		return first;
	}

	public int getSize() {
		return size;
	}

}
